@import './theme/default.less';
@thead-background-color: @theme-stroke-8;
@border-color: @theme-stroke-7;

.zent-grid {
  font-size: 12px;
  color: @theme-stroke-1;
  position: relative;
  line-height: 1.5;
  overflow: hidden;

  &.zent-grid-scroll-position-left {
    .zent-grid-fixed-left {
      box-shadow: none;
    }
  }

  &.zent-grid-scroll-position-right {
    .zent-grid-fixed-right {
      box-shadow: none;
    }
  }

  &-table {
    width: 100%;
    text-align: left;
    border-collapse: separate;
    border-spacing: 0;

    /* 取消边框, 和 table 一致 */
    border-top: 1px solid @border-color;

    &-ellipsis {
      table-layout: fixed;

      .zent-grid-nowrap {
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }

  &-text-align-left {
    text-align: left;
  }

  &-text-align-right {
    text-align: right;
  }

  &-text-align-center {
    text-align: center;
  }

  &-nowrap {
    white-space: nowrap;
    word-break: keep-all;
  }

  &-thead {
    &-sort-desc,
    &-sort-asc {
      margin-left: 3px;
    }

    &-sort-desc {
      &::after {
        content: "\2193";
      }
    }

    &-sort-asc {
      &::after {
        content: "\2191";
      }
    }
  }

  &-fixed {
    width: auto;
  }

  &-fixed-left,
  &-fixed-right {
    position: absolute;
    top: 0;
    overflow: hidden;

    .zent-grid-fixed {
      border-left: none;
      border-right: none;
    }
  }

  &-fixed-left {
    left: 0;
    box-shadow: 4px 0 4px @theme-mask-black-2;

    .zent-grid-header .zent-grid-table {
      border-right: none;
    }

    .zent-grid-body {
      margin-right: -20px;
      box-sizing: border-box;
      margin-bottom: -15px;
      overflow: scroll;
    }
  }

  &-fixed-right {
    right: 0;
    box-shadow: -4px 0 4px @theme-mask-black-2;

    .zent-grid-header .zent-grid-table {
      border-left: none;
    }

    .zent-grid-body .zent-grid-table {
      border-left: none;
    }

    .zent-grid-body {
      box-sizing: border-box;
      margin-bottom: -15px;
      overflow: scroll;
    }
  }

  &-scroll {
    overflow: auto;

    table {
      width: auto;
      min-width: 100%;
    }

    .zent-grid-header {
      overflow-x: scroll;
      margin-bottom: -15px;
      padding-bottom: 15px;
    }

    .zent-grid-body {
      position: relative;
    }
  }

  &-empty {
    text-align: center;
    height: 50px;
    line-height: 50px;
    border-bottom: 1px solid @border-color;
  }

  &-tr {
    display: table-row;
    background-color: @theme-stroke-10;

    &:hover {
      background: @thead-background-color;
    }

    &__mouseover {
      background: @thead-background-color;
    }

    &__expanded {
      td {
        padding: 16px 10px;
        word-break: break-all;
        background-color: @theme-stroke-9;
      }
    }
  }

  &-th,
  &-td {
    line-height: 18px;
    display: table-cell;
    box-sizing: border-box;
    border-bottom: 1px solid @border-color;
    vertical-align: middle;
  }

  &-th {
    padding: 11px 10px;
    background-color: @thead-background-color;
    font-weight: normal;
  }

  &-td {
    padding: 16px 10px;

    .zent-grid-expandable-btn {
      cursor: pointer;
      display: inline-block;
      width: 14px;
      height: 14px;
      text-align: center;
      line-height: 12px;
      border: 1px solid @theme-stroke-7;
      user-select: none;
      background: @theme-stroke-10;

      &.zent-grid-expand-btn::after {
        content: "+";
        box-sizing: border-box;
      }

      &.zent-grid-collapse-btn::after {
        content: "-";
        box-sizing: border-box;
      }
    }
  }

  &-tfoot {
    margin-top: 10px;
    overflow: hidden;

    .zent-grid-tfoot-page {
      margin-top: 0;
    }
  }

  &-tfoot-page {
    margin-top: 10px;
    float: right;
  }

  a {
    color: @theme-primary-2;
    cursor: pointer;
  }
}
